﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>新建编辑应用信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
</head>
<body>
  <div class="layui-form" lay-filter="form-add" id="form-add" style="padding: 20px 30px 0 0;">
    <input type="hidden" name="id" value="" />
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用名称：</label>
      <div class="layui-input-inline">
        <input type="text" name="name" lay-verify="required" style="width:400px;" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">安装路径：</label>
      <div class="layui-input-inline">
        <input type="text" name="apppath" lay-verify="required" style="width:400px;" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用类型：</label>
      <div class="layui-input-inline">
        <select name="apptype" id="apptype" lay-verify="required" style="width:400px;" >
          <option value="user" selected>用户应用</option>
          <option value="plugin">应用插件</option>
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用标识：</label>
      <div class="layui-input-inline">
        <input type="text" name="appkey" lay-verify="required" style="width:400px;" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用版本：</label>
      <div class="layui-input-inline">
        <input type="text" name="version" lay-verify="required" style="width:400px;" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用作者：</label>
      <div class="layui-input-inline">
        <input type="text" name="author" style="width:400px;" value="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label" style="width: 100px">应用简介：</label>
      <div class="layui-input-inline">
        <textarea name="intro" style="width:400px;" class="layui-textarea"></textarea>
      </div>
    </div>
    <div class="layui-form-item layui-hide">
      <input type="button" lay-submit lay-filter="btn_submit" id="btn_submit" value="确定">
    </div>
  </div>
  <script src="/plugins/layui/layui.js"></script>
  <script>
  layui.config({
    base: '/plugins/layuiadmin/'
  }).extend({
    index: 'lib/index'
  }).use(['index', 'form'], function(){
    var $ = layui.$, form = layui.form;
    form.on('submit(btn_submit)', function (data) {
      layer.load();
      var field = data.field; 
      var index = parent.layer.getFrameIndex(window.name); 
      $.ajax({
            type: "post",
            url: "app_add",
            data: field,
            dataType: "json",
            success: function (res) {
              layer.closeAll('loading'); 
              if (res.code == 0)
              {
                layer.msg(res.msg,{time:1*1000},function(){
                    parent.layer.close(index);
                    parent.GetFirstList();
                });
              }
              else
              {
                layer.alert(res.msg)
              }
            }
      });
    });
  })
  </script>
</body>
</html>